package com.itheima.token;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
//表明这是个配置类
@Configuration
////实现接口配置拦截器
public class DemoMvn implements WebMvcConfigurer {

    @Autowired
    private DemoInterceptor demoInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
//        将名为 demoInterceptor 的拦截器添加到注册表中。
        registry.addInterceptor(demoInterceptor)
//                设置该拦截器要拦截哪些请求路径
                .addPathPatterns("/**")
//                对哪些路径放行
                .excludePathPatterns("/login");
    }
}
